default_platform(:tvos)

platform :tvos do
  desc "Description of what the lane does"
  lane :build_simulator do
    build_app(
      skip_package_ipa: true,
      skip_archive: true,
      destination: "platform=tvOS Simulator,name=Apple TV"
  )
  end

  lane :build_unsign_ipa do
    sh "cd .. && rm -rf Payload *.xcarchive *.ipa *.zip"
    build_app(
    destination: "generic/platform=tvOS",
    configuration: "Release",
    codesigning_identity:"",
    skip_codesigning: true,
    skip_package_ipa: true,
    archive_path: "App.xcarchive",
    )
    FastlaneCore::CommandExecutor.execute(command: "cd .. && mv App.xcarchive/Products/Applications ./Payload")
    zip(
      path: "./Payload",
      output_path: "BilbiliAtvDemo"
    )
    sh "cd .. && mv BilbiliAtvDemo.zip BilbiliAtvDemo.ipa"
    sh "cd .. && rm -rf Payload *.xcarchive *.zip || true"
  end
end
